.class public Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;
.super Ljava/lang/Object;


# instance fields
.field private buffer:Ljava/io/BufferedWriter;

.field private file:Ljava/io/File;

.field private fileName:Ljava/lang/String;

.field private writer:Ljava/io/FileWriter;


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->fileName:Ljava/lang/String;

    invoke-direct {p0}, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->init()V

    return-void
.end method

.method private init()V
    .locals 2

    new-instance v0, Ljava/io/File;

    iget-object v1, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->fileName:Ljava/lang/String;

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->file:Ljava/io/File;

    :try_start_0
    new-instance v0, Ljava/io/FileWriter;

    iget-object v1, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->file:Ljava/io/File;

    invoke-direct {v0, v1}, Ljava/io/FileWriter;-><init>(Ljava/io/File;)V

    iput-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->writer:Ljava/io/FileWriter;

    new-instance v0, Ljava/io/BufferedWriter;

    iget-object v1, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->writer:Ljava/io/FileWriter;

    invoke-direct {v0, v1}, Ljava/io/BufferedWriter;-><init>(Ljava/io/Writer;)V

    iput-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->buffer:Ljava/io/BufferedWriter;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    invoke-static {v0}, Lcom/wqmobile/sdk/protocol/cmd/b;->a(Ljava/lang/Exception;)V

    goto :goto_0
.end method


# virtual methods
.method public close()V
    .locals 2

    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->writer:Ljava/io/FileWriter;

    const-string v1, "Intialise before closing"

    invoke-static {v0, v1}, Lcom/wqmobile/sdk/pojoxml/util/Assert;->isNull(Ljava/lang/Object;Ljava/lang/String;)V

    :try_start_0
    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->buffer:Ljava/io/BufferedWriter;

    invoke-virtual {v0}, Ljava/io/BufferedWriter;->flush()V

    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->writer:Ljava/io/FileWriter;

    invoke-virtual {v0}, Ljava/io/FileWriter;->close()V

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->fileName:Ljava/lang/String;

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->file:Ljava/io/File;

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->writer:Ljava/io/FileWriter;

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->buffer:Ljava/io/BufferedWriter;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    invoke-static {v0}, Lcom/wqmobile/sdk/protocol/cmd/b;->a(Ljava/lang/Exception;)V

    goto :goto_0
.end method

.method public write(Ljava/lang/String;)V
    .locals 1

    :try_start_0
    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->writer:Ljava/io/FileWriter;

    invoke-virtual {v0, p1}, Ljava/io/FileWriter;->write(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    invoke-static {v0}, Lcom/wqmobile/sdk/protocol/cmd/b;->a(Ljava/lang/Exception;)V

    goto :goto_0
.end method
